import React from 'react';

import { createBrowserRouter, Navigate } from 'react-router-dom';

const App = React.lazy(() => import('../App'));
const Login = React.lazy(() => import('../pages/Login/Login'));
const Home = React.lazy(() => import('../pages/Home/Home'));
const Class = React.lazy(() => import('../pages/Class/Class'));
const Cars = React.lazy(() => import('../pages/Cars/Cars'));
const My = React.lazy(() => import('../pages/My/My'));
const Editinfo = React.lazy(() => import('../pages/My/Editinfo'));
const Order = React.lazy(() => import('../pages/My/Order'));
const Coupon = React.lazy(() => import('../pages/My/Coupon'));
const Code = React.lazy(() => import('../pages/My/Code'));
const Red = React.lazy(() => import('../pages/My/Red'));
const Ma = React.lazy(() => import('../pages/My/Ma'));
const Complaince = React.lazy(() => import('../pages/My/Complaince'));
const Setting = React.lazy(() => import('../pages/My/Setting'));
const Remark = React.lazy(() => import('../pages/My/Remark'));
const RefundApply = React.lazy(() => import('../pages/My/RefundApply'));
const RefundPending = React.lazy(() => import('../pages/My/RefundPending'));
const RefundSuccess = React.lazy(() => import('../pages/My/RefundSuccess'));
const RefundFailed = React.lazy(() => import('../pages/My/RefundFailed'));
const PaymentSuccess = React.lazy(() => import('../pages/My/PaymentSuccess'));
const Payment = React.lazy(() => import('../pages/My/Payment'));
const Shou = React.lazy(() => import('../pages/Shou/Shou'));
const SearchResult = React.lazy(() => import('../pages/SearchResult/SearchResult'));
const Zhi = React.lazy(() => import('../pages/Zhi/Zhi'));
const Xiugaidingwei = React.lazy(() => import('../pages/Xiu/Xiugaidingwei'));
const Location = React.lazy(() => import('../pages/Location/Location'));
const Registration = React.lazy(() => import('../pages/Register/Registration'));
const Face = React.lazy(() => import('../pages/face/Face'));
const Xian = React.lazy(() => import('../pages/Home/Xian'));
const Pin = React.lazy(() => import('../pages/Home/Pin'));
const Vipqy = React.lazy(() => import('../pages/My/Vipqy'));
const Ai = React.lazy(() => import('../pages/My/Ai'));



const router = createBrowserRouter([
  {
    path: '/', element: <Navigate to="/login" replace />
  },
  {
    path: '/app', element: <App />, children: [
      { path: 'home', element: <Home /> },
      { path: 'class', element: <Class /> },
      { path: 'cars', element: <Cars /> },
      { path: 'my', element: <My /> },
      { path: 'shou', element: <Shou /> },
      { path: 'searchResult', element: <SearchResult /> },
      { path: 'zhi', element: <Zhi /> },
      { path: 'location', element: <Location /> },
      { path: 'xiugaidingwei', element: <Xiugaidingwei /> },
    ]
  },
  { path: '/my/order', element: <Order /> },
  { path: '/my/editinfo', element: <Editinfo /> },
  { path: '/my/coupon', element: <Coupon /> },
  { path: '/my/code', element: <Code /> },
  { path: '/my/red', element: <Red /> },
  { path: '/my/ma', element: <Ma /> },
  { path: '/my/complaince', element: <Complaince /> },
  { path: '/my/setting', element: <Setting /> },
  { path: '/my/remark', element: <Remark /> },
  { path: '/my/refund-apply', element: <RefundApply /> },
  { path: '/my/refund-pending', element: <RefundPending /> },
  { path: '/my/refund-success', element: <RefundSuccess /> },
  { path: '/my/refund-failed', element: <RefundFailed /> },
  { path: '/my/payment', element: <Payment /> },
  { path: '/my/payment-success', element: <PaymentSuccess /> },
  { path: '/my/vipqy', element: <Vipqy /> },
  { path: '/my/ai', element: <Ai /> },
  { path: '/login', element: <Login /> },
  { path: '/register', element: <Registration /> },
  { path: '/face', element: <Face /> },
  { path: '/xian', element: <Xian /> },
  { path: '/pin', element: <Pin /> },
  { path: '*', element: <Navigate to="/login" replace /> },
]);

export default router;